/*
 * Copyright (c) 2018, dreamkaylee@foxmail.com All Rights Reserved.
 */

package com.common.shiro.listener;

import org.apache.shiro.session.Session;
import org.apache.shiro.session.SessionListener;

import com.common.shiro.util.ShiroCacheUtil;

/**
 * shiro监听在线用户上下线
 * 
 * @author limk
 * @date 2018年2月13日 下午12:15:58
 * @version 1.0
 */
public class OnlineListener implements SessionListener {

	@Override
	public void onStart(Session session) {

	}

	@Override
	public void onStop(Session session) {
		ShiroCacheUtil.kickOutUserBySessionId(session.getId().toString());
	}

	@Override
	public void onExpiration(Session session) {
		ShiroCacheUtil.kickOutUserBySessionId(session.getId().toString());
	}

}
